Skip to content

Support includes when parsing CMake preset files - #624

Merged
nikobockerman merged 1 commit into
mainfrom
support-includes-in-cmake-preset-files
Jul 25, 2026
Merged

Support includes when parsing CMake preset files#624
nikobockerman merged 1 commit into
mainfrom
support-includes-in-cmake-preset-files

Conversation

@nikobockerman

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 21, 2026 21:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the project’s minimal CMake preset reader to support include directives in preset JSON files, enabling presets to be composed across multiple files (including recursive includes) and supporting limited macro expansion in include paths.

Changes:

  • Add recursive traversal of preset include graphs when resolving presets.
  • Implement limited macro expansion for include paths (${hostSystemName} and $penv{VAR}), with errors on unsupported macros.
  • Expand and refactor tests to cover include behavior, recursion, relative path resolution, and macro expansion.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
aoc-main/src/aoc_main/_cmake_presets.py Adds include-graph traversal, include macro expansion, and a cached file loader to support presets spread across multiple files.
aoc-main/tests/test_cmake_presets.py Refactors preset-file writing helper and adds test coverage for includes, recursion, relative include resolution, and macro behaviors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread aoc-main/src/aoc_main/_cmake_presets.py
Copilot AI review requested due to automatic review settings July 25, 2026 17:08
@nikobockerman
nikobockerman force-pushed the support-includes-in-cmake-preset-files branch from d40c445 to ff3aa9d Compare July 25, 2026 17:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

aoc-main/src/aoc_main/_cmake_presets.py:176

  • _walk() yields the implicit project file(s) before the current file’s explicit include list. Because _get_preset() returns the first match, this makes presets from user-included files lower-precedence than project presets, which contradicts the stated “user presets take precedence over project presets” behavior when a user include defines the same preset name as the project file. Traverse explicit includes before implicit convention-includes so user-side includes still override project presets.
        for include_path in implicit:
            yield from self._walk(include_path, visited=visited)

        for include_path in preset_file.includes:
            if self._load_file(include_path) is None:

Comment thread aoc-main/src/aoc_main/_cmake_presets.py
@nikobockerman
nikobockerman merged commit 2344e34 into main Jul 25, 2026
53 checks passed
@nikobockerman
nikobockerman deleted the support-includes-in-cmake-preset-files branch July 25, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants